/**
  * @FileName: RegisterRequest.java
  * @Package:com.bdtop.dbl.server.apis
  * @Description: TODO
  * @author: MingjunLi
  * @date:2014-9-17
  * @version V1.0
  */
package com.bdtop.dbl.server.request;

import com.bdtop.dbl.server.response.BaseResponse;
import com.bdtop.dbl.thirdparty.asynchttp.HttpPostRequest;
import com.bdtop.dbl.thirdparty.asynchttp.RequestCallback;
import com.bdtop.dbl.utils.Constants;
import com.bdtop.dbl.utils.DBLDebug;
import com.google.gson.Gson;

/**
 * @ClassName: RegisterRequest
 * @Description: TODO
 * @author: MingjunLi
 * @date:2014-9-17
 */
public class RegisterRequest extends HttpPostRequest {
    
    /**
      * @param callback
      */
    public RegisterRequest(RequestCallback callback) {
        super(callback);
        getRequestParams().add(Constants.COMMAND, Constants.CMD_REGISTER);
    }
    
    public void setParams(String phoneNumber) {
        getRequestParams().add(Constants.PARAM_USER_NAME, phoneNumber);
    }

    @Override
    protected String getUrl() {
        return Constants.SERVER_ADDRESS;
    }

    @Override
    protected Object parse(String responseString) {
        DBLDebug.logd("RegisterRequest response:" + responseString);
        
        Gson gson = new Gson();
        BaseResponse baseResponse = gson.fromJson(responseString, BaseResponse.class);
        
        return baseResponse;
    }
    

}
